Skip to content

Release/0.3.0#34

Merged
zhen-he merged 3 commits into
mainfrom
release/0.3.0
May 9, 2026
Merged

Release/0.3.0#34
zhen-he merged 3 commits into
mainfrom
release/0.3.0

Conversation

@zhen-he

@zhen-he zhen-he commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing API to change)
  • Documentation only

Checklist

  • pytest tests/ passes locally.
  • For new public API or behaviour changes: docstrings updated.
  • docs/source/release.md updated under the next version heading.
  • For non-trivial changes: an issue exists where the design was discussed.

Related issues

zhen-he added 3 commits May 9, 2026 09:53
Reshape the user-facing API around a single MuData input and
mdata.obsm output keys. New entry points:

- MIDAS.setup_mudata(mdata, batch_key=...) registers data setup info
  on the MuData (mdata.uns['_scmidas']) and replaces the previous
  class-level state mutation.
- MIDAS(mdata, configs=..., batch_size=...) constructs the model
  directly from a registered MuData. Instance state instead of
  class-level state — fixes a bug where two MIDAS() instances in one
  process would clobber each other.
- model.get_latent_representation(kind='c'|'u'|'joint') and
  model.get_imputed_values(modality=...) return arrays aligned to
  mdata.obs_names, ready for direct assignment to mdata.obsm /
  mdata.layers.
- model.save(dir) / MIDAS.load(dir, mdata) write/read a model.pt +
  setup.json pair.
- scmidas.datasets.from_dir(dir_path, label_dir=...) loads the
  directory-format datasets (mat/<m>.mtx, mask/<m>.csv,
  feat/feat_dims.toml) into a MuData, including per-batch masks,
  cell labels, and ATAC chromosome chunk dims.
- scmidas.pl.umap(mdata, basis='X_midas', color=[...]) and
  scmidas.pl.modality_grid(model, mdata, label_key=...) wrap the
  common visualizations as one-call helpers and route through a thin
  AnnData wrapper to side-step the current scanpy + MuData plotting
  limitations.
- ATAC binarization is now applied by default whenever 'atac' is
  among the modalities; pass transform={'atac': None} to opt out.

scmidas.integrate() now uses the new path internally and writes the
joint biological latent to mdata.obsm['X_midas'] (configurable via
key_added).

Backwards compatibility:
- MIDAS.configure_data_from_mdata and MIDAS.configure_data_from_dir
  still work — they emit a DeprecationWarning and will be removed
  in 0.4.0.
- save_checkpoint / load_checkpoint still work; new code should use
  save / load.

Other fixes:
- predict(joint_latent=False) no longer raises KeyError: 'z_c'.

15 new pytest cases pin the new API surface (setup, construct,
multi-instance independence, latent/imputation shapes, save/load
round-trip, deprecation warning).
Tutorials:
- New preparing_your_data.ipynb walks from a public 10x Genomics
  5k PBMC CITE-seq sample through QC, HVG selection, MuData wrap,
  MIDAS integration, Leiden clustering, and a synthetic mosaic
  example. Single-file Python pipeline; ~5 min on a mid-range GPU.
- Merge inputs.rst + outputs.rst into a single data_layout.rst that
  describes the MuData input/output contract. The directory format
  is moved to an "Advanced" subsection.
- Rewrite demo1, demo2, demo3 to use the new API:
  scmidas.datasets.from_dir(...) -> setup_mudata -> MIDAS(mdata) ->
  get_latent_representation. The 22-line per-modality grid block in
  each demo collapses to scmidas.pl.modality_grid(model, mdata).
  Each demo gains a 6.4 "After integration" section showing
  Leiden + UMAP on mdata.obsm['X_midas'].
- examples/quickstart.ipynb uses scmidas.pl.umap and a 5-line
  scanpy-friendly downstream.
- Rewrite advanced/tensorboard.rst and
  advanced/development_instructions.rst to use the new API; the
  "Adding a new modality" section is reorganized into two clear
  steps (configs, then registry registration) with a concrete
  asinh5 example for transform_registry.
- tutorials/basics/index.rst toctree leads with preparing_your_data
  and data_layout, then the three demos.

API reference:
- New scmidas.api.rst, scmidas.datasets.rst, scmidas.plot.rst.
- modules_index.rst toctree updated.

README:
- Quick start uses the new API (sc.pp.neighbors(use_rep='X_midas')).
- New "Bring your own data" section linking the preparing_your_data
  tutorial and the data_layout reference.
See docs/source/release.md for the full v0.3.0 entry.
@zhen-he zhen-he merged commit 95651c0 into main May 9, 2026
5 checks passed
@zhen-he zhen-he deleted the release/0.3.0 branch May 9, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant